package com.example.javafx.scrollPane;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

/**
 * 创建滚动窗格
 */
public class Main_1 extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {

        Group root = new Group();
        Scene scene = new Scene(root,500,500);
        primaryStage.setScene(scene);

        Rectangle rect = new Rectangle(200,200, Color.RED);
        ScrollPane s1 = new ScrollPane();
        s1.setPannable(true);
        s1.setPrefSize(120,120);
        s1.setContent(rect);

        root.getChildren().add(s1);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
